.\" $OpenBSD: SSL_SESSION_new.3,v 1.7 2019/06/12 09:36:30 schwarze Exp $
.\"
.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: June 12 2019 $
.Dt SSL_SESSION_NEW 3
.Os
.Sh NAME
.Nm SSL_SESSION_new
.Nd construct a new SSL_SESSION object
.Sh SYNOPSIS
.In openssl/ssl.h
.Ft SSL_SESSION *
.Fn SSL_SESSION_new void
.Sh DESCRIPTION
.Fn SSL_SESSION_new
allocates and initializes an new
.Vt SSL_SESSION
object.
The reference count is set to 1, the time to the current time, and
the timeout to five minutes.
.Pp
When the object is no longer needed, it can be destructed with
.Xr SSL_SESSION_free 3 .
.Pp
.Fn SSL_SESSION_new
is used internally, for example by
.Xr SSL_connect 3 .
.Sh RETURN VALUES
.Fn SSL_SESSION_new
returns the new
.Vt SSL_SESSION
object or
.Dv NULL
if insufficient memory is available.
.Pp
After failure,
.Xr ERR_get_error 3
returns
.Dv ERR_R_MALLOC_FAILURE .
.Sh SEE ALSO
.Xr d2i_SSL_SESSION 3 ,
.Xr PEM_read_SSL_SESSION 3 ,
.Xr ssl 3 ,
.Xr SSL_connect 3 ,
.Xr SSL_copy_session_id 3 ,
.Xr SSL_CTX_add_session 3 ,
.Xr SSL_CTX_sess_set_get_cb 3 ,
.Xr SSL_get_session 3 ,
.Xr SSL_SESSION_free 3 ,
.Xr SSL_SESSION_get0_peer 3 ,
.Xr SSL_SESSION_get_compress_id 3 ,
.Xr SSL_SESSION_get_ex_new_index 3 ,
.Xr SSL_SESSION_get_id 3 ,
.Xr SSL_SESSION_get_master_key 3 ,
.Xr SSL_SESSION_get_protocol_version 3 ,
.Xr SSL_SESSION_get_time 3 ,
.Xr SSL_SESSION_has_ticket 3 ,
.Xr SSL_SESSION_print 3 ,
.Xr SSL_SESSION_set1_id_context 3 ,
.Xr SSL_set_session 3
.Sh HISTORY
.Fn SSL_SESSION_new
first appeared in SSLeay 0.5.2 and has been available since
.Ox 2.4 .
